package com.max.back.demo.form;


import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

@Data
public class DrugForm {
    public interface Base {
    }

    public interface Find {
    }

    public interface Delete {
    }

    public interface Update extends Base {
    }

    @NotBlank(groups = {Base.class, Update.class, Delete.class},message = "药品编号不能为空")
    @Length(max = 36, groups = {Base.class, Update.class, Delete.class},message = "药品编号长度不能超过36")
    private String number;
    @NotBlank(groups = {DrugForm.Base.class, DrugForm.Update.class},message = "药品名不能为空")
    @Length(max = 100, groups = {DrugForm.Base.class, DrugForm.Update.class},message = "药品名长度不能超过100")
    private String name;
    @NotBlank(groups = {DrugForm.Base.class, DrugForm.Update.class},message = "药品规格不能为空")
    @Length(max = 100, groups = {DrugForm.Base.class, DrugForm.Update.class},message = "药品规格长度不能超过100")
    private String spci;
    @NotBlank(groups = {DrugForm.Base.class, DrugForm.Update.class},message = "药品单位不能为空")
    @Length(max = 100, groups = {DrugForm.Base.class, DrugForm.Update.class},message = "药品单位长度不能超过100")
    private String unit;
    @NotNull(groups = {DrugForm.Base.class, DrugForm.Update.class},message = "药品价格不能为空")
    @Min(value = 0, groups = {DrugForm.Base.class, DrugForm.Update.class},message = "药品名价格不能小于0")
    private float price;
    @NotBlank(groups = {DrugForm.Base.class, DrugForm.Update.class},message = "药品剂型不能为空")
    @Length(max = 100, groups = {DrugForm.Base.class, DrugForm.Update.class},message = "药品剂型长度不能超过100")
    private String type1;
    @NotBlank(groups = {DrugForm.Base.class, DrugForm.Update.class},message = "药品类型不能为空")
    @Length(max = 100, groups = {DrugForm.Base.class, DrugForm.Update.class},message = "药品类型长度不能超过100")
    private String type2;
}
